#/usr/bin/bash

iter=5

if [ $# -lt 2 ] 
then
    echo Usage: eval.sh orgin target
    exit
fi

origin=$1
target=$2

rm -rf BFS.log BFS.tim Key.log Key.tim

echo Starting on Key

for i in `seq 1 $iter` ; do
    echo Trial $i

    echo >> Key.log
    echo Trial $i >> Key.log
    echo >> Key.log
    ( time java traverser/KeywordTraverser $origin $target >> Key.log ) 2>> Key.tim

done

echo Finished Key, starting on BFS

for i in `seq 1 $iter` ; do
    echo Trial $i

    echo >> BFS.log
    echo Trial $i >> BFS.log
    echo >> BFS.log
    ( time java traverser/TrieTraverser $origin $target >> BFS.log ) 2>> BFS.tim

done

echo Finished

